home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: MegaDisc / MegaDisc 13 (1989)(MegaDisc Digital Publishing)(AU)[b missing files][WB].zip / MegaDisc 13 (1989)(MegaDisc Digital Publishing)(AU)[b missing files][WB].adf / PROGRAMS / tinybmap < prev    next >
Text File  |  1989-05-22  |  3KB  |  149 lines

  1. CLS
  2. startit:
  3.  
  4.  
  5. LOCATE 8,15:PRINT "1. Load BMAP"
  6. LOCATE 10,15:PRINT "2. Quit"
  7. LOCATE 12,15:INPUT "Select one ", A
  8. ON A GOSUB loadbmap,endit
  9. GOTO startit
  10.  
  11. loadbmap:
  12. bmap.name$=""
  13. lib.name$=""
  14. subname$=""
  15. q$=CHR$(34)
  16. CLS
  17. startload:
  18. PRINT
  19. PRINT "Name (including pathname) of desired"
  20. INPUT "bmap to load ";b$
  21. IF RIGHT$(b$,5) <> ".bmap" THEN
  22.     PRINT
  23.     PRINT "Spelling is incorrect or file is misnamed.  A bmap file NAME"
  24.     PRINT "must end with " + q$ + ".bmap" + q$ + "."
  25.     GOTO startload
  26. END IF
  27.  
  28. OPEN b$ FOR INPUT AS 1
  29. bmap$=INPUT$(LOF(1),1)
  30. CLOSE 1
  31.  
  32. namelength%=LEN(b$)
  33. startpoint%=namelength%-5
  34. rf$=""
  35. rev$=""
  36. control%=100
  37.  
  38. WHILE control% > 96 AND control% < 123 AND startpoint% > 0
  39.   rf$=MID$(b$,startpoint%,1)
  40.   control%=ASC(rf$)
  41.   rev$=rev$ + rf$
  42.   startpoint%=startpoint%-1
  43. WEND
  44.  
  45. revlen%=LEN(rev$)
  46. test%=ASC(RIGHT$(rev$,1))
  47.  
  48. IF test% > 96 OR test% <123 THEN
  49.   rev$=LEFT$(rev$,revlen%-1)
  50. END IF
  51.  
  52. n$=""
  53. FOR x%=revlen% TO 1 STEP -1
  54.   n$=n$+MID$(rev$,x%,1)
  55. NEXT
  56.  
  57. bmap.name$=n$+".bmap"
  58. lib.name$=n$+".library"
  59. subname$= n$+".MSB"
  60.  
  61. GetRoutine bmap$,lib.name$,bmap.name$,subname$
  62. NewCycle
  63. RETURN
  64.  
  65. endit:
  66. MENU RESET
  67. END
  68. RETURN
  69.  
  70. SUB GetRoutine (bmap$,LIB$,BN$,S$) STATIC
  71. CLS
  72. start:
  73. routine$=""
  74. FD$=""
  75. q$=CHR$(34)
  76.  
  77. PRINT
  78. PRINT "Name of first "+LIB$+" routine"
  79. INPUT "you wish to use ";routine$
  80. IF routine$="" THEN start
  81.  
  82. again:
  83. FD$=FD$+"fd$=fd$+" + q$ + routine$ + q$
  84. FD$=FD$+ " + chr$(0)" + CHR$(10)
  85.  
  86. routine$=routine$+CHR$(0)
  87. offset%=INSTR(bmap$,routine$)
  88.  
  89. IF offset%=0 THEN
  90.   PRINT "I can't find this routine"
  91.   PRINT "Check spelling."
  92.   GOTO start
  93. END IF
  94.  
  95. length%=LEN(routine$)
  96. count%=offset%+length%
  97. FD$=FD$+"fd$=fd$+"
  98.  
  99. char$=""
  100. WHILE char$<>CHR$(0)
  101.   char$=MID$(bmap$,count%,1)
  102.   FD$=FD$+"chr$("+STR$(ASC(char$)) + ")" + "+"
  103.   count%=count%+1
  104. WEND
  105.  
  106. newlength%=LEN(FD$)-1
  107. FD$=LEFT$(FD$,newlength%)
  108. FD$=FD$+CHR$(10)
  109.  
  110. PRINT
  111. PRINT "Thank you.  Next routine?"
  112. INPUT "(if none press RETURN) ",routine$
  113. IF routine$="" THEN
  114.   GOTO goon
  115.   ELSEIF routine$=CHR$(127) THEN
  116.   GOTO start
  117.   ELSE
  118.   GOTO again
  119. END IF
  120.  
  121. goon:
  122. final.length%=LEN(FD$)-1
  123. FD$=LEFT$(FD$,final.length%)
  124. PRINT
  125. INPUT "name of destination file ";destfile$
  126. IF destfile$="" THEN goon
  127. F$=" FOR OUTPUT AS 1"
  128. OPEN destfile$ FOR OUTPUT AS 1
  129. PRINT #1,""
  130. PRINT #1,"SUB " + S$ + " STATIC"
  131. PRINT #1,FD$
  132. PRINT #1,"OPEN " + q$ + "RAM:" + BN$ + q$ + F$
  133. PRINT #1,"PRINT #1,FD$;"
  134. PRINT #1,"CLOSE 1"
  135. PRINT #1,"LIBRARY " + q$ + "RAM:" + LIB$ + q$
  136. PRINT #1,"END SUB"
  137. CLOSE 1
  138. END SUB
  139.  
  140. SUB NewCycle STATIC
  141. CLS
  142. LOCATE 4,1
  143. q$=CHR$(34)
  144. PRINT "If you wish to use routines from another LIBRARY select"
  145. PRINT q$ + "Load bmap" + q$ + " from menu."
  146. END SUB
  147.  
  148.  
  149.